#include "xcommonglobal.h"
namespace zdh
{
	XLog * Log;
	class XCommonGlobal : public ILogConfig, public ICommonGlobal
	{
	public:
		void setLevel(ELogLevel paramLevel)
		{
			m_Log.setLevel(paramLevel);
		}
		void setConsoleOut(bool paramConsoleOutFlag)
		{
			m_Log.setPrintScreen(paramConsoleOutFlag);
		}
		void setShortDateTimeFormat(bool paramShortFormat) 
		{
			m_Log.setShortDateTimeFormat(paramShortFormat);
		}

		void setFileOut(bool paramFileOutFlag, const char * paramFileName, XInt paramFileSize) 
		{
			if( paramFileOutFlag )
			{
				m_Log.CloseLogFile();
				m_Log.setFileName(paramFileName);
				m_Log.setFileSize(paramFileSize);
				m_Log.OpenLogFile();
			}
			else
			{
				m_Log.CloseLogFile();
			}
		}
		ILogConfig * getLogConfig()
		{
			return this;
		}
		void Init()
		{
			Log = &m_Log;
		}
	private:
		XLog m_Log;
	};

	ICommonGlobal * ICommonGlobal::getInstance()
	{
		static XCommonGlobal sGlobal;
		return &sGlobal;
	}
}